﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="FormUsuarios.aspx.cs" Inherits="FormUsuarios" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
	<link href="http://localhost:1360/css/formlist.css" rel="stylesheet" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

	<%--  <script>
    	$(document).ready(function () {
    		$('#' + '<%= btnSave.ClientID %>').button();
        	$('#' + '<%= btnCancel.ClientID %>').button();
        });
    </script>--%>
    
        <div style="width: 100%; height: -11px;">
        </div>
        <div class="container formEncl">
            <div class="formWrap">
                <div style="margin-top: 10px;">
                    <span>Nombre de Usuario:</span>
                </div>
                <div>
                    <asp:TextBox ID="txtUser" runat="server"></asp:TextBox>
                    <input id="usuario_id" type="hidden" runat="server" value="0"/>
                    <input id="usuario_concurrencia" type="hidden" runat="server" value="0"/>
                    <input id="usuario_estado" type="hidden" runat="server" value="0"/>
                </div>
                <div style="margin-top: 10px;">
                    <span>Contraseña:</span>
                </div>
                <div>
                    <asp:TextBox ID="txtPassw" runat="server" TextMode="Password"></asp:TextBox>
                </div>
                <div style="margin-top: 10px;">
                    <span>Personal:</span>
                </div>
                <div>
                    <asp:DropDownList ID="comboPersonal" runat="server" Height="16px" Width="164px"></asp:DropDownList>
                </div>
                <div style="margin-top: 10px;">
                    <span>Rol:</span>
                </div>
                <div>
                    <asp:DropDownList ID="comboRol" runat="server" Height="16px" Width="162px"></asp:DropDownList>
                </div>
                <div class="formControl">
                    <asp:Button ID="btnSave" runat="server" Text="Guardar" OnClick="btnSave_Click" /><asp:Button ID="btnCancel" runat="server" Text="Cancelar"/>
                    <br />
                    <br />
                    <br />
                    <asp:GridView ID="grdvUsuarios" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="iUsuario_id" DataSourceID="SqlDataSourceUsuarios" BackColor="#666666" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" ForeColor="Black">
                        <Columns>
                            
                            <asp:BoundField DataField="sNombreUsuario" HeaderText="sNombreUsuario" SortExpression="sNombreUsuario" />
                            <asp:BoundField DataField="sPassword" HeaderText="sPassword" SortExpression="sPassword" />
                            <asp:BoundField DataField="iPersona_id" HeaderText="iPersona_id" SortExpression="iPersona_id" />
                            <asp:BoundField DataField="iRol_id" HeaderText="iRol_id" SortExpression="iRol_id" />
                            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
                        </Columns>
                        <FooterStyle BackColor="#CCCCCC" />
                        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
                        <RowStyle BackColor="White" />
                        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
                        <SortedAscendingCellStyle BackColor="#F1F1F1" />
                        <SortedAscendingHeaderStyle BackColor="#808080" />
                        <SortedDescendingCellStyle BackColor="#CAC9C9" />
                        <SortedDescendingHeaderStyle BackColor="#383838" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSourceUsuarios" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:bd_ActivosFijosConnectionString %>" DeleteCommand="DELETE FROM [Tbl_Usuarios] WHERE [iUsuario_id] = @original_iUsuario_id AND [sNombreUsuario] = @original_sNombreUsuario AND [sPassword] = @original_sPassword AND [iPersona_id] = @original_iPersona_id AND [iRol_id] = @original_iRol_id" InsertCommand="INSERT INTO [Tbl_Usuarios] ([sNombreUsuario], [sPassword], [iPersona_id], [iRol_id]) VALUES (@sNombreUsuario, @sPassword, @iPersona_id, @iRol_id)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [Tbl_Usuarios]" UpdateCommand="UPDATE [Tbl_Usuarios] SET [sNombreUsuario] = @sNombreUsuario, [sPassword] = @sPassword, [iPersona_id] = @iPersona_id, [iRol_id] = @iRol_id WHERE [iUsuario_id] = @original_iUsuario_id AND [sNombreUsuario] = @original_sNombreUsuario AND [sPassword] = @original_sPassword AND [iPersona_id] = @original_iPersona_id AND [iRol_id] = @original_iRol_id">
                        <DeleteParameters>
                            <asp:Parameter Name="original_iUsuario_id" Type="Int32" />
                            <asp:Parameter Name="original_sNombreUsuario" Type="String" />
                            <asp:Parameter Name="original_sPassword" Type="String" />
                            <asp:Parameter Name="original_iPersona_id" Type="Int32" />
                            <asp:Parameter Name="original_iRol_id" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="sNombreUsuario" Type="String" />
                            <asp:Parameter Name="sPassword" Type="String" />
                            <asp:Parameter Name="iPersona_id" Type="Int32" />
                            <asp:Parameter Name="iRol_id" Type="Int32" />
                        </InsertParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="sNombreUsuario" Type="String" />
                            <asp:Parameter Name="sPassword" Type="String" />
                            <asp:Parameter Name="iPersona_id" Type="Int32" />
                            <asp:Parameter Name="iRol_id" Type="Int32" />
                            <asp:Parameter Name="original_iUsuario_id" Type="Int32" />
                            <asp:Parameter Name="original_sNombreUsuario" Type="String" />
                            <asp:Parameter Name="original_sPassword" Type="String" />
                            <asp:Parameter Name="original_iPersona_id" Type="Int32" />
                            <asp:Parameter Name="original_iRol_id" Type="Int32" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                    <br />
                </div>
            </div>
        </div>
  
</asp:Content>

